﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BenevolentSun
{
    class SaveProfileScreen : LoadingScreen
    {

        public SaveProfileScreen()
        {
            IsPopup = true;
        }

        public override void LoadContent()
        {
            Session.OnSaved += new EventHandler(Session_OnSaved);
            Session.SaveSession();

            base.LoadContent();
        }

        void Session_OnSaved(object sender, EventArgs e)
        {
            Console.WriteLine("Saved");

            Session.OnSaved -= this.Session_OnSaved;

            Session.OnRecordsSaved += new EventHandler(Session_OnRecordsSaved);
            Session.SaveRecords();
        }

        void Session_OnRecordsSaved(object sender, EventArgs e)
        {
            Session.OnRecordsSaved -= this.Session_OnRecordsSaved;

            Console.WriteLine("Records Saved");
            ExitScreen();
        }

    }
}
